<?php
include("conn.php");
$pagenum = empty($_REQUEST['pagenum'])?1:$_REQUEST['pagenum'];
$pagesize = $_REQUEST['pagesize'];
// $action = $_REQUEST['action'];
$arr = array(
    "code"=>200,
    "msg"=>"查询成功",
    "data"=>null
);
/* switch ($action) {
    case 'student':
    $sql = "select * from student limit ".($pagenum-1)*$pagesize.",{$pagesize}";
        break;
    
    default:
        # code...
        break;
} */
// if($action=="student"){
    $sql = "select * from student limit ".($pagenum-1)*$pagesize.",{$pagesize}";
// }

    $result = mysqli_query($conn,$sql);
    $allnews = array();
    if( mysqli_num_rows($result)>0 ){
        while ($arr = mysqli_fetch_object($result)){
            $allnews[] = $arr;
        }
        $arr['data'] = $allnews;//所有的记录集转成对象
    }else{
        $arr['code'] = 201;
        $arr['msg'] = "暂无记录";
    }

die(json_encode($arr));
?>